<template>
	<view class="pt30">
		<mg-input @input="change" :value="receipt" formt="2" last="1">
			<view slot="bd">
				<view class="f30">打开自动接单</view>
				<view class="mt10 f24 c9">开通自动接单后，在线期间，将自动接单并打印</view>
			</view>
		</mg-input>
		<mg-load v-show="showloading" type="2"></mg-load>
	</view>
</template>

<script>
import { mapState, mapActions } from 'vuex';
import mgInput from '@/components/form/mg-input.vue';
export default {
	name: 'ddsz',
	components: {
		mgInput
	},
	data() {
		return {
			showloading: true,
			receipt: '0'
		};
	},
	async onLoad(options) {
		this.util.setNT('设置');
		this.util
			.request({
				url: this.api.xgmdzt
			})
			.then(res => {
				if (res.code == 1) {
					this.receipt = res.data.receiveStatus;
				} else {
					this.util.message(res.msg, 3);
				}
				this.showloading = false;
			})
			.catch(e => {});
	},
	computed: {},
	methods: {
		async change(e) {
			this.showloading = true;
			let res = await this.util
				.request({
					url: this.api.xgmdzt,
					method: 'POST',
					data: {
						type: 2,
						receiveStatus: e
					}
				})
				.catch(e => {});
			this.showloading = false;
			if (res) {
				this.util.message('操作成功', 3);
			}
		}
	}
};
</script>
<style scoped lang="scss">
.menu-label {
	padding: 20rpx 30rpx;
}
</style>
